#!/bin/bash

nerdctl_version=1.3.1

# download nerdctl full
wget https://ghproxy.com/https://github.com/containerd/nerdctl/releases/download/v$nerdctl_version/nerdctl-full-$nerdctl_version-linux-amd64.tar.gz

tar Cxzvvf /usr/local nerdctl-full-$nerdctl_version-linux-amd64.tar.gz

sudo mkdir -p /etc/containerd

containerd config default > /etc/containerd/config.toml

# config
sed -i 's#SystemdCgroup = false#SystemdCgroup = true#' /etc/containerd/config.toml

systemctl daemon-reload
systemctl enable --now containerd
systemctl enable --now buildkit

systemctl restart containerd
systemctl status containerd
systemctl status buildkit